package com.nineclock.auth.exception;

import org.springframework.http.ResponseEntity;
import org.springframework.security.oauth2.common.exceptions.OAuth2Exception;
import org.springframework.security.oauth2.provider.error.DefaultWebResponseExceptionTranslator;

/**
 *  @author: 小康
 *  @Date:  2021.6.22 15:33
 *
 */
public class NcWebResponseExceptionTranslator extends DefaultWebResponseExceptionTranslator {

    @Override
    public ResponseEntity<OAuth2Exception> translate(Exception e) throws Exception {
        NcOAuth2Exception ncOAuth2Exception = new NcOAuth2Exception(e.getMessage(), e);
        return super.translate(ncOAuth2Exception);
    }
}
